<%--
  Created by IntelliJ IDEA.
  User: snksnk1091
  Date: 2017/8/27
  Time: 23:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Mr.Lair后台登陆页面</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link href="../../statics/css/bootstrap.min.css" rel="stylesheet">
    <link href="../../statics/css/style.css" rel="stylesheet">
    <link href="../../statics/css/Alogin.css" rel="stylesheet">
    <link href="../../statics/css/ATopMenu.css" rel="stylesheet">
    <script src="../../statics/js/jquery-3.0.0.js"></script>
    <script src="../../statics/js/layer.js"></script>
</head>
<body>
<div class="container">
    <div class="row">
        <div class="title aTopMenu">后台用户登录</div>
    </div>
    <div class="row alogin">
        <%--<input class="hidden" name="role" id="role" value="admin">--%>
        <div class="col-sm-8 col-sm-offset-2">
            <div class="col-sm-4 labelself">用户名：</div>
            <div class="col-sm-8"><input class="form-control" type="text" name="userName" id="userName" placeholder="请输入用户名"/></div></div>
        <div class="col-sm-8 col-sm-offset-2">
            <div class="col-sm-4 labelself">密&nbsp;码：</div>
            <div class="col-sm-8"><input class="form-control" type="text" name="password" id="password" placeholder="请输入密码"></div></div>
        <%--<div>--%>
            <%--验证码：<input onkeypress="getKey();" type="text" placeholder="请输入验证码" name="msg" class="msg" id="verificationcode">--%>
            <%--<img id="img" src="${ctx}/authImage" style="width: 10rem" alt="code"/>--%>
            <%--<a href='#' onclick="javascript:changeImg()" ><label>看不清？</label></a>--%>
        <%--</div>--%>
        <div class="col-sm-8 col-sm-offset-2" style="text-align: center">
            <button class="btn btn-info" name="login" id="login" onclick="login()">登录</button>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <button class="btn btn-info" name="signIn" id="signIn" onclick="signIn()">注册</button>
        </div>
    </div>
    <div class="container">
        <div class="row">
            <div class="col-sm-3"><h4>企业简介</h4></div>
            <div class="col-sm-3"><h4>联系方式</h4></div>
            <div class="col-sm-3"><h4>京ICP备案号：000000000</h4></div>
            <div class="col-sm-3"><h4>邮箱：LZXisPigHaHaHa@PIG.com</h4></div>
        </div>
    </div>
</div>
<script type="text/javascript">
    function login() {
        var login = {
            userName: $("#userName").val(),
            password: $("#password").val()
        };
        $.ajax({
            type: 'post',
            url: '/AdminUser/adminUserLogin',
            data: JSON.stringify(login),
            contentType:'application/json',
            dataType: 'json',
            success:function (data) {
                if(data.data == "SUCCESS"){
                    layer.msg('登陆成功，正在跳转');
                    document.location.href = "/AMenu/aSignInNormalUser";
                }else if(data.data == "PASSWORDCHECK_ERROR"){
                    layer.msg('密码输入有误');
                }else {
                    layer.msg("该用户不存在");
                }
            }
            
        })
    }

    function signIn() {
        document.location.href="/AMenu/aSignInAdminUser";
    }
</script>
</body>
</html>
